package hrm.serviceimple;

import hrm.dao.EmployeeDAO;
import hrm.daoimple.EmployeeDAOImple;
import hrm.dto.insa.EmployeeDTO;
import hrm.service.EmployeeService;

import java.util.List;

public class EmployeeServiceImple implements EmployeeService{
	
	private EmployeeDAO employeeDAO;
	private static EmployeeServiceImple employeeService;
	
	private EmployeeServiceImple(){
		employeeDAO=new EmployeeDAOImple();
	}
	
	public static EmployeeServiceImple getInstance(){
		if (employeeService==null) {
			employeeService=new EmployeeServiceImple();
		}
		return employeeService;
	}
	
	public void setEmployeeDAO(EmployeeDAO employeeDAO) {
		this.employeeDAO = employeeDAO;
	}

//=== employee
	@Override
	public boolean insertEmployee(EmployeeDTO dto) {
		return employeeDAO.insertEmployee(dto);
	}

	@Override
	public List getAllEmployee(EmployeeDTO dto) {
		return employeeDAO.getAllEmployee(dto);
	}

	@Override
	public EmployeeDTO getEmployee(EmployeeDTO dto) {
		return employeeDAO.getEmployee(dto);
	}

	@Override
	public void updateEmployee(EmployeeDTO command) {
		employeeDAO.updateEmployee(command);
	}
	
	public void updateCamEmployee(EmployeeDTO dto){
		employeeDAO.updateCamEmployee(dto);
	}
}
